home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 357 / text0000.txt < prev   
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  32 lines

  1. David Byrden <100101.2547@compuserve.com> (02 Feb 96):
  2.  
  3. > >> It requires every program to have the main() function (which
  4. > >> implementation is not allowed to supply) with parameters (void) or (int
  5. > >> argc, int*argv[]). However, Windows programs have another convention:
  6. > >> prrogram must contain the function  int WinMain
  7. >
  8. > I remember reading that you can write a Windows program with a main()
  9. > function and the usual command line arguments, and then the Microsoft
  10. > compiler will then generate WinMain somehow....but that the "operating
  11. > system" does link to WinMain.
  12.  
  13. No, the operating system doesn't care whether there is a  
  14. WinMain(), a main() or anything else. It just reads a  
  15. pointer  from the exe file and calls it. This is usually the  
  16. C/C++ statup code, which then calls WinMain() or main().
  17. If there is a main present, the linker makes the startup  
  18. code call it, if not the linker either sets in an own  
  19. main(), which calls WinMain(), or another startup code,  
  20. which calls main().
  21.  
  22. Claus
  23.  
  24. ------------------------------------------------------------------------
  25. Claus Andre Faerber - claus@faerber.muc.de - http://www.muc.de/~cfaerber
  26. ------------------------------------------------------------------------
  27.  
  28. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  29.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  30.   summarized in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  31. ]
  32.